home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
math
/
differ.zip
/
GENLIB.H
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-02
|
1KB
|
37 lines
#ifndef GENLIB
#define GENLIB
typedef enum {ERROR = -1, FALSE, TRUE , SUCCESS} logical;
#define bool(x) (!(!(x)))
#define bitset(arg,posn) ((arg) | (1L << (posn)))
#define bitclr(arg,posn) ((arg) & ~(1L << (posn)))
#define bittst(arg,posn) bool((arg) & (1L << (posn)))
/*
** DosDate macros - access bitfield values from DOS file date & time
** for Borland C and C++ compilers by: Wayne Hamilton
*/
#define dd_yr(d) (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->yr)
#define dd_mo(d) (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->mo)
#define dd_day(d) (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->day)
#define dd_hr(t) (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->hr)
#define dd_mn(t) (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->mn)
#define dd_sec(t) (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->sec)
/* then: year = dd_yr(ffblk.ff_date); */
#define LOBYTE(x) ((unsigned char)(x))
#define HIBYTE(x) ((unsigned int)(x) >> 8)
#define plural_text(n) &"s"[(1 == (n))]
#define plural_text2(n) &"es"[(1 == (n)) << 1]
#define NUL '\0'
#define FAR far
#define BYTE unsigned char
#define WORD unsigned int
#endif